<?php
    class MemberView {
   
		private $m_getFirstName = "firstname";
		private $m_getLastName = "lastname";
		private $m_getSsn = "ssn";
		private $m_getRegister = "register";
		private $m_getUpdate = "update";
		private $m_getAddBoatInfo = "triedAddBoatInfo";
		private $m_getMemberId = "memberId";
		private $m_getMemberButton = "memberButton";
		private $m_getDelete = "delete";
		
		public function DoRegisterView() {
			return "
			<h2>Registrera medlem</h2>
			<form method='POST'>
				<fieldset>
					<legend>Registrering</legend>
						<p><label>Namn:</label> <input type='text' name='$this->m_getFirstName' id='name' /></p>
						<p><label>Namn:</label> <input type='text' name='$this->m_getLastName' id='name' /></p>
						<p><label>Personnummer</label> <input type='text' name='$this->m_getSsn' id='ssn' /></p>
						<p><input type='submit' value='Registrera' name='$this->m_getRegister' id='register' />
				</fieldset>
			</form>	
			";
		}
		
		public function DoDelete() {
			
			return "
				<h2>Ta bort medlem</h2>
				<form method='POST'>
					<fieldset>
						<legend>Skriv in id:t</legend>
							<p><label>Medlemsnummer:</label> <input type='text' name='$this->m_getMemberId' id='memberId' /></p>
							<p><input type='submit' value='Ta bort medlem' name='$this->m_getDelete' id='delete' />
					</fieldset>
				</form>
			";
		}
		
		public function DoUpdateView() {
			return "
			<h2>Uppdatera medlem</h2>
			<form method='POST'>
				<fieldset>
					<legend></legend>
						<p><label>Medlemsnummer:</label> <input type='text' name='$this->m_getMemberId' id='memberId' /></p>
						<p><label>Namn:</label> <input type='text' name='$this->m_getFirstName' id='firstname' /></p>
						<p><label>Efternamn:</label> <input type='text' name='$this->m_getLastName' id='lastname' /></p>
						<p><label>Personnummer</label> <input type='text' name='$this->m_getSsn' id='ssn' /></p>
						<p><input type='submit' value='Ändra uppgifter' name='$this->m_getUpdate' id='register' />
				</fieldset>
			</form>	
			";
		}
		
		public function DoViewOneMember(){
			return "
			<h2>Visa medlem</h2>
			<form method='POST'>
				<fieldset>
					<legend></legend>
						<p><label>Medlemsnummer:</label> <input type='text' name='$this->m_getMemberId' id='memberId' /></p>
						<p><input type='submit' value='Titta på uppgifter' name='$this->m_getMemberButton' id='register' />
				</fieldset>
			</form>	
			";
		}	
		
		public function GetFirstName() {
			if (isset($_POST[$this->m_getFirstName]) != null) {
					return $_POST[$this->m_getFirstName];
			}
			return null;
		}
		
		public function GetLastName() {
			if (isset($_POST[$this->m_getLastName]) != null) {
					return $_POST[$this->m_getLastName];
			}
			return null;
		}
		
		public function GetSsn() {
			if (isset($_POST[$this->m_getSsn]) != null) {
					return $_POST[$this->m_getSsn];
			}
			return null;
		}
		
		public function GetMemberId() {
			if (isset($_POST[$this->m_getMemberId]) != null) {
					return $_POST[$this->m_getMemberId];
			}
			return null;
		}

		public function TriedToRegister() {
			if(isset($_POST[$this->m_getRegister]) != null) {
				return true;
			}
			return false;
		}
		
		public function TriedToDelete() {
			if(isset($_POST[$this->m_getDelete]) != null) {
				return true;
			}
			return false;
		}
		
		public function TriedToUpdate() {
			if(isset($_POST[$this->m_getUpdate]) != null) {
				return true;
			}
			return false;
		}

		public function TriedToView(){
			if(isset($_POST[$this->m_getMemberButton]) != null){
				return true;
			}
			return FALSE;
		}
    }
?>